<%@ page import="com.minxi.jsp.javabean.UserInfo" %>
<%@ page import="java.util.List" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024-06-20
  Time: 19:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<style>
    table {
        width: 100%;
        border-collapse: collapse;
    }
    table, th, td {
        border: 1px solid #ddd;
    }
    th, td {
        padding: 8px;
        text-align: center;
    }
    th {
        background-color: #f2f2f2;
    }
    .a_container {
        position: absolute; /* 使用绝对定位 */
        top: 20px; /* 距离顶部0像素 */
        right: 15px; /* 距离右边0像素 */
    }
    .a_btu {
        /* 按钮的样式 */
        padding: 10px 20px;
        background-color: transparent;
        color: black;
        border: none;
        cursor: pointer;
        /* 其他按钮样式 */
        font-size: 25px;
    }
    .a_btu:hover{
        color: red;
    }
</style>
<body>

<%
    String path = request.getContextPath();
    List<UserInfo> userList = (List<UserInfo>) request.getSession().getAttribute("userList");
%>
<h1>学生管理系统列表页</h1>
<div class="a_container">
    <a href="<%=path%>/jsp/index.jsp" class="a_btu">返回主页</a>
</div>
<hr>
<a href="<%=path%>/jsp/add.jsp" class="a_btu">新增用户</a>
<table>
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>年龄</th>
        <th>性别</th>
        <th>手机号</th>
        <th>操作</th>
    </tr>

    <%for (UserInfo userInfo : userList) {%>
    <tr>
        <td><%=userInfo.getId()%></td>
        <td><%=userInfo.getUserName()%></td>
        <td><%=userInfo.getUserAge()%></td>
        <%--            三元运算符 1男 2女--%>
        <td><%=1 == userInfo.getUserSex() ? "男":"女"%></td>
        <td><%=userInfo.getUserPhone()%></td>
        <td>
            <%--                <form action="" method="get">--%>
            <%--                    <input type="submit">--%>
            <%--                    <input type="text" name="id" value="1">--%>
            <%--                    删除 修改 查看详情--%>
            <%--                </form>--%>
            <a href="<%=path%>/del?id=<%=userInfo.getId()%>">删除</a>
            <a href="<%=path%>/jspUpdate?id=<%=userInfo.getId()%>">修改</a>
            <a href="<%=path%>/detail?id=<%=userInfo.getId()%>">查看详情</a>
        </td>
    </tr>
    <%}%>
</table>
</body>
</html>
